import Blockly from 'blockly/core'
import 'blockly/python_compressed'
import 'blockly/blockly_compressed'
import 'blockly/blocks_compressed'

Blockly.Blocks.function_assert = {
  init: function () {
    this.appendValueInput('statement').setCheck(null).appendField('assert')
    this.setInputsInline(true)
    this.setPreviousStatement(true, null)
    this.setNextStatement(true, null)
    this.setColour(230)
    this.setTooltip('')
    this.setHelpUrl('')
  }
}

Blockly.Python.function_assert = function (block) {
  const valueStatement = Blockly.Python.valueToCode(
    block,
    'statement',
    Blockly.Python.ORDER_ATOMIC
  )
  const code = 'assert ' + valueStatement + '\n'
  return code
}

export default Blockly
